Next | Prev | Up | Top | Contents | Index

Optimization Options

Invoke the optimizer by specifying a compiler, such as cc(1), with any of the options listed in Table 5-1.

Optimization Options
OptionResult
-O0Performs no optimization that may complicate debugging. No attempt is made to minimize memory access by keeping values in registers, and little or no attempt is made to eliminate redundant code. This is the default.
-O1Performs as many local optimizations as possible without affecting compile-time performance. No attempt is made to minimize memory access by keeping values in registers, but much of the locally redundant code is removed.
-O2, -OPerforms extensive global optimization. The optimizations at this level are generally conservative in the sense that they:
(1) provide code improvements commensurate with the compile time spent
(2) are almost always beneficial
(3) avoid changes that affect such things as floating point results
-O3Performs aggressive optimization. The additional optimization at this level focuses on maximizing code quality even if that requires extensive compile time or relaxing language rules. -O3 is more likely to use transformations that are usually beneficial but can hurt performance in isolated cases. This level may cause noticeable changes in floating point results due to relaxing expression evaluation rules (see the discussion of floating point optimization and the -OPT:roundoff option below).

Refer to the applicable compiler reference page for details on the options.


Next | Prev | Up | Top | Contents | Index